<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/detail/login.css">
    <title>Document</title>
    <style>
        #app{
            width: 100%;
            height: 100%;
            overflow-y: auto;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="gold-login">
            <!-- <div class="head">
                <div class="h-left">×</div>
                <div class="h-middle"></div>
                <div class="h-right"></div>
            </div> -->
            <div class="fold-login-content">
                <p class="fold-login-title" style="float: left">账号登录</p>
                <!--<img src="../../img/login-logo.jpg" alt="" width="90" style="float: right">-->
            </div>
            <div class="fold-login-form">
                <form action="">
                    <div class="fold-form-con">
                        <input type="text" class="gold-username" placeholder="手机号" onkeyup="this.value=this.value.replace(/\s+/g,'')">
                    </div>
                    <div class="fold-form-con">
                        <input type="password" class="gold-password" type="password" placeholder="请输入密码" onkeyup="this.value=this.value.replace(/\s+/g,'')">
                    </div>

                    <div class="login-con">
                        <a class="gold-login-a"  @click="submit">登录</a>
                    </div>
                    <div class="login-con-zhu">
                        <a class="gold-login-zhu" @click="register" style="margin-bottom: 0.5rem;">注册</a>
                    </div>
                </form>
            </div>
            <div class="gold-farget">
                <a href="forget_password.html">忘记密码？</a>
            </div>
        </div>
    </div>
    <script src="../../js/common.js"></script>
    <script src="../../js/jquery-2.2.3.min.js"></script>
    <script src="../../js/rem.js"></script>
    <script src="../../js/common.js"></script>

    <!--<script src="js/cc.js"></script>-->
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/vue-resource.min.js"></script>
    <script src="layer-v3.1.1/layer/layer.js"></script>
    <script>
        var app = new Vue({
            el:'#app',
            data:{

            },
            methods:{
                submit:function () {
                    let mobile = $('.gold-username').val(),
                        password = $('.gold-password').val();
                    this.$http.post(SURL + '/api/login',{mobile:mobile,password:password},{emulateJSON : true}).then(function (res) {
                        if(res.body.code != 0){
                            layer.msg(res.body.msg);
                        }else {
                            localStorage.setItem('userId',res.body.data.userId);
                            localStorage.setItem('token',res.body.data.token);
                            // localStorage.setItem('level',res.body.data.level);
                            location.href = '../index/index.html';
                        }
                    })
                },
                register:function () {
                    location.href = 'register.html'
                }
            }
        })
    </script>
</body>

</html>
